<!--
 * @Description: history
 * @Author: rendc
 * @Date: 2021-09-09 09:59:11
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-09 11:13:13
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>history</title>
</head>

<body>
  <button onclick="link()">测试按钮</button>
  <br>
  <button onclick="back()">←👈🏻</button>
  <br>
  <button onclick="forWard()">→👉🏻</button>
  <br>
  <button onclick="goBackTwo()">go(-2)</button>
  <button onclick="goBackThree()">go(-3)</button>
</body>
<script>
  console.log(history);

  function goBackTwo() {
    history.go(-2);
  }

  function goBackThree() {
    history.go(-3);
  }

  function back() {
    console.log("跳转到上一页");
    history.back();
  }

  function forWard() {
    console.log("跳转到下一页");
    history.forward();
  }

  function link() {

  }
</script>

</html>